//
// Created by Administrator on 2023/11/3.
// 素数埃氏筛法
//


#include <cmath>
#include <iostream>

using namespace std;

int main()
{
    int n=100; // out: 25
    n = 1740948; // out: 130971
//    n= 2115790; //out:156902
    bool isP[n + 1]={0};
    for (int i = 2; i <= n; ++i)
        isP[i]=1;
    for (int i = 2; i <=n; ++i)
    {
        if(isP[i])
        {
            for (int j = i*2; j <= n ; j+=i)
            {
                isP[j]=0;
            }
        }
    }
    int count=0;
    for (int i = 2; i <=n; ++i)
    {
        if(isP[i])
        {
            ++count;
//            cout<<i<<' ';
        }
    }
    cout<<endl<<count;
    return 0;
}